package com.example.administrator.testproject.x5web;

import android.os.Bundle;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.webkit.WebView;

import com.example.administrator.testproject.R;
import com.tencent.smtt.sdk.QbSdk;
import com.tencent.smtt.sdk.ValueCallback;

import java.util.HashMap;

public class PdfActivity extends AppCompatActivity {

    private WebView mWebView;
    String url="";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pdf);
        mWebView = (WebView)findViewById(R.id.webview);
        QbSdk.initX5Environment(this, new QbSdk.PreInitCallback() {
            @Override
            public void onCoreInitFinished() {
            }

            @Override
            public void onViewInitFinished(boolean b) {
            }
        });
        url= Environment.getExternalStorageDirectory().getAbsolutePath()+"/aaa.pdf";
//        url= "http://www8.cao.go.jp/okinawa/8/2012/0409-1-1.pdf";
        HashMap<String, String> params = new HashMap<>();
        params.put("style","1");
        params.put("local","true");
        QbSdk.isDefaultDialog=false;

        QbSdk.openFileReader(this, url, params, new ValueCallback<String>() {
            @Override
            public void onReceiveValue(String s) {
                Log.e("Tag",s+"加载状态");
            }
        });
    }
}
